import { _videoList } from "../../api/video";

const videoStore = {
  namespaced: true,
  state: {
    videoList: [], //视频列表
    count: 0, //数据总条数的state
  },
  mutations: {
    changeVideo(state, data) {
      state.videoList = data.data.list;
      state.count = data.data.count;
    },
  },
  actions: {
    // 获取视频列表的接口
    async videoAction({ commit }, data) {
      console.log(data);
      var res = await _videoList(data);
      console.log(res);
      commit("changeVideo", res);
    },
  },

  getters: {
    videoList: (state) => state.videoList,
    count: (state) => state.count,
  },
};
export default videoStore;
